#define LED 8
#define FEN 7

void setup() {
  Serial.begin(9600);
  pinMode(LED,OUTPUT);
  pinMode(FEN,OUTPUT);
  digitalWrite(LED, LOW);
  analogWrite(FEN, 0);
}
void loop() {
  int a = analogRead(A0);
  int b = analogRead(A1);
  Serial.print("温度:");
  Serial.println(a);
  Serial.print("光照:");
  Serial.println(b);
  if(a <= 500)
  {
    analogWrite(FEN, 1024);
  }
  else
  {
    analogWrite(FEN, 0);
  }
  if(b >= 600)
  {
    digitalWrite(LED, HIGH);
  }
  else
  {
    digitalWrite(LED, LOW);
  }
  delay(500);
}
